/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.me.entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "T_SUBCATEGORIA_ARTICULOS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TSubcategoriaArticulos.findAll", query = "SELECT t FROM TSubcategoriaArticulos t"),
    @NamedQuery(name = "TSubcategoriaArticulos.findByNIdSubcategoriaArticuloPk", query = "SELECT t FROM TSubcategoriaArticulos t WHERE t.nIdSubcategoriaArticuloPk = :nIdSubcategoriaArticuloPk"),
    @NamedQuery(name = "TSubcategoriaArticulos.findByVDescripcionSubcategoria", query = "SELECT t FROM TSubcategoriaArticulos t WHERE t.vDescripcionSubcategoria = :vDescripcionSubcategoria")})
public class TSubcategoriaArticulos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "N_ID_SUBCATEGORIA_ARTICULO_PK")
    private Short nIdSubcategoriaArticuloPk;
    @Basic(optional = false)
    @Column(name = "V_DESCRIPCION_SUBCATEGORIA")
    private String vDescripcionSubcategoria;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nIdSubcategoriaArticuloFk")
    private List<TModelosArticulos> tModelosArticulosList;
    @JoinColumn(name = "N_ID_CATEGORIA_ARTICULO_FK", referencedColumnName = "N_ID_CATEGORIA_ARTICULO_PK")
    @ManyToOne(optional = false)
    private TCategoriaArticulos nIdCategoriaArticuloFk;

    public TSubcategoriaArticulos() {
    }

    public TSubcategoriaArticulos(Short nIdSubcategoriaArticuloPk) {
        this.nIdSubcategoriaArticuloPk = nIdSubcategoriaArticuloPk;
    }

    public TSubcategoriaArticulos(Short nIdSubcategoriaArticuloPk, String vDescripcionSubcategoria) {
        this.nIdSubcategoriaArticuloPk = nIdSubcategoriaArticuloPk;
        this.vDescripcionSubcategoria = vDescripcionSubcategoria;
    }

    public Short getNIdSubcategoriaArticuloPk() {
        return nIdSubcategoriaArticuloPk;
    }

    public void setNIdSubcategoriaArticuloPk(Short nIdSubcategoriaArticuloPk) {
        this.nIdSubcategoriaArticuloPk = nIdSubcategoriaArticuloPk;
    }

    public String getVDescripcionSubcategoria() {
        return vDescripcionSubcategoria;
    }

    public void setVDescripcionSubcategoria(String vDescripcionSubcategoria) {
        this.vDescripcionSubcategoria = vDescripcionSubcategoria;
    }

    @XmlTransient
    public List<TModelosArticulos> getTModelosArticulosList() {
        return tModelosArticulosList;
    }

    public void setTModelosArticulosList(List<TModelosArticulos> tModelosArticulosList) {
        this.tModelosArticulosList = tModelosArticulosList;
    }

    public TCategoriaArticulos getNIdCategoriaArticuloFk() {
        return nIdCategoriaArticuloFk;
    }

    public void setNIdCategoriaArticuloFk(TCategoriaArticulos nIdCategoriaArticuloFk) {
        this.nIdCategoriaArticuloFk = nIdCategoriaArticuloFk;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nIdSubcategoriaArticuloPk != null ? nIdSubcategoriaArticuloPk.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TSubcategoriaArticulos)) {
            return false;
        }
        TSubcategoriaArticulos other = (TSubcategoriaArticulos) object;
        if ((this.nIdSubcategoriaArticuloPk == null && other.nIdSubcategoriaArticuloPk != null) || (this.nIdSubcategoriaArticuloPk != null && !this.nIdSubcategoriaArticuloPk.equals(other.nIdSubcategoriaArticuloPk))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.me.entityBeans.TSubcategoriaArticulos[ nIdSubcategoriaArticuloPk=" + nIdSubcategoriaArticuloPk + " ]";
    }
    
}
